#include<iostream>
using namespace std;
int main()
{int n,x;
 while(cin>>x)
{if(x==0)   break;
 for(int i=1;i<=145;i++)
   {if(x>=i*(i+1)/2&&x<(i+1)*(i+2)/2)  {n=i;break;}
   }
 int sum=0;
 for(int j=1;j<=n;j++)
  sum=sum+j*j;
  
  sum=sum+(n+1)*(x-n*(n+1)/2);
  cout<<x<<" "<<sum<<endl;
}
system("pause");
return 0;
}
